package com.leetcode.algorithm.y22.m09.w3;

import java.util.Arrays;

/**
 * 1619. 删除某些元素后的数组均值
 * 
 * https://leetcode.cn/problems/mean-of-array-after-removing-some-elements/
 * 
 * @author jie.deng
 *
 */
class Question1619Solution01 {

	public double trimMean(int[] arr) {
		Arrays.sort(arr);
		int len = arr.length;
		long sum = 0;
		for (int i = len / 20 * 1; i < len / 20 * 19; i++) {
			sum += arr[i];
		}
		return (double) sum / (len / 20 * 18);
	}

}